#!/usr/bin/python
# -*- coding: UTF-8 -*-

from __future__ import print_function   # print('hello',end = ' ')
import random
# secret = random.randint(0,3)  #这是一个闭区间

name = (u'夏立军 - 汉诺塔 -')
print(name)


def hanoi(n, x, y, z):
    if n == 1:
        print(x, ' --> ', z)
    else:
        hanoi(n - 1, x, z, y)  # 将前 n-1 个盘子从 X 移动到 Y 上
        print(x, ' --> ', z)   # 将最底下的最后一个盘子从X移动到Z上
        hanoi(n - 1, y, x, z)  # 将Y上的n-1个盘子移动到Z上


alt = u'请输入汉诺塔的层数:'
print(alt)
num = input("> ")
if num.isdigit():
    num = int(num)
    hanoi(num,'X','Y','Z')
else:
    print(u'你输入的不是数字!')




